package com.final_project.zombiemenace;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

import com.final_project.zombiemenace.custom.view.CustomProgressBar;

public class LogoScreenActivity extends Activity {
	private Thread logoTimer;
	private static final int LOGO_SCREEN_DURATION = 50;

	private CustomProgressBar progressBar;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.logo_screen);
		progressBar = (CustomProgressBar) findViewById(R.id.loading_progress_bar);
	}

	@Override
	protected void onStart() {
		super.onStart();
		if (logoTimer == null) {
			logoTimer = new Thread() {
				@Override
				public void run() {
					int loop = progressBar.getProgress();
					while (loop <= progressBar.getMax()) {
						progressBar.setProgress(loop);
						try {
							sleep(LOGO_SCREEN_DURATION);
						} catch (InterruptedException e) {
							e.printStackTrace();
						}
						loop += 1;
					}
					Intent menuIntent = new Intent(LogoScreenActivity.this,
							MainMenuActivity.class);
					startActivity(menuIntent);
					finish();
				}
			};
			logoTimer.setName("Logo Timer");
			logoTimer.start();
		}
	}

	@Override
	protected void onStop() {
		super.onStop();
	}
	 @Override
	public void onBackPressed() {
//		super.onBackPressed();
	}
}
